package com.rmdjzz.slmmn.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rmdjzz.slmmn.mapper.SongMapper;
import com.rmdjzz.slmmn.pojo.base.Song;
import com.rmdjzz.slmmn.service.SongService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @作者 张绍鑫
 * @创建时间 2023/5/27
 */
@Service
@Slf4j
public class SongServiceImpl extends ServiceImpl<SongMapper, Song> implements SongService {
    @Autowired
    private SongMapper songMapper;
    @Override
    public int updateSongWords(Integer id, String words) {
        return songMapper.updateSongWords(id,words);
    }

    @Override
    public int sum() {
        try {
            return songMapper.sum();
        }catch (RuntimeException e){
            log.info("没有查询到播放次数的总数");
            return 0;
        }
    }

    @Override
    public int resetSoaring() {
        return songMapper.resetSoaring();
    }
}
